﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;

namespace SEVN.Web.Framework.Modules.Footer
{
    public partial class Footer0101 : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            XmlReader xml = XmlReader.Create(Server.MapPath(@"Xml/Footer.xml"));

            xml.ReadStartElement("footer");
            xml.ReadStartElement("copyright");
            string copyright = xml.ReadString();
            xml.ReadEndElement();
            xml.ReadStartElement("address");
            string address = xml.ReadString();
            xml.ReadEndElement();
            xml.ReadStartElement("email");
            string email = xml.ReadString();
            xml.ReadEndElement();
            xml.ReadStartElement("phone");
            string phone = xml.ReadString();
            xml.ReadEndElement();
            xml.ReadStartElement("fax");
            string fax = xml.ReadString();
            xml.ReadEndElement();
            xml.ReadStartElement("designby");
            string designby = xml.ReadString();
            xml.ReadEndElement();
            xml.ReadStartElement("backgroundimage");
            string bgImage = xml.ReadString();
            xml.ReadEndElement();
            xml.ReadEndElement();

            string footer = "<div id='footer' style='background-image: url(" + bgImage + ");' >";
            if (!string.IsNullOrEmpty(copyright))
                footer += "<span id='copyright'>Bản quyền thuộc về " + copyright + "</span><br />";
            if (!string.IsNullOrEmpty(address))
                footer += "<span id='address'>Địa chỉ: " + address + "</span><br />";
            if (!string.IsNullOrEmpty(email))
                footer += "<span id='email' style='padding:5px 8px;'>Email: " + email + "</span>     ";
            if (!string.IsNullOrEmpty(phone))
                footer += "<span id='phone' style='padding:5px 8px;'>Điện thoại: " + phone + "</span>     ";
            if (!string.IsNullOrEmpty(fax))
                footer += "<span id='fax' style='padding:5px 8px;'>Fax: " + fax + "</span>";
            if (!string.IsNullOrEmpty(designby))
                footer += "<br /><span id='designby'>Thiết kế bởi " + designby + "</span>     ";
            footer += "</div>";

            litFooter.Text = footer;
        }
    }
}